/**
 * This is Data.保存全局变量
 * @author fufeng
 * @Time 2023-6-22
 */

package com.example.myapplication.db;

import android.provider.BaseColumns;


public final class Data implements BaseColumns {
    /**
     * 数据库信息
     */
    public static final String SQLITE_NAME="Users.db";
    public static final int SQLITE_VERSION=1;
    /**
     * 信息表，及其字段
     */
    public static final String NodeArray_Table = "NodeArray";
    public static final String NodeLocal_Table = "NodeLocalInfo";
    public static final String SensorData_Table = "SensorData";
    public static final String UserInfo_Table = "UserInfo";

    public static final String COLUMN_Index="_index";
    public static final String COLUMN_Gateway = "GatewayID";
    public static final String COLUMN_GatewayType = "GatewayType";
    public static final String COLUMN_NodeName="NodeName";
    public static final String COLUMN_NodeState = "NodeState";
    public static final String COLUMN_Time="Time";
    public static final String COLUMN_BatteryLevel="BatteryLevel";
    public static final String COLUMN_SensorNum = "SensorNum";
    public static final String COLUMN_SensorType0="SensorType0";
    public static final String COLUMN_SensorData0="SensorData0";
    public static final String COLUMN_SensorType1="SensorType1";
    public static final String COLUMN_SensorData1="SensorData1";
    public static final String COLUMN_SensorType2="SensorType2";
    public static final String COLUMN_SensorData2="SensorData2";
    public static final String COLUMN_SensorType3="SensorType3";
    public static final String COLUMN_SensorData3="SensorData3";
    public static final String COLUMN_SensorType4="SensorType4";
    public static final String COLUMN_SensorData4="SensorData4";
    public static final String COLUMN_SensorType5="SensorType5";
    public static final String COLUMN_SensorData5="SensorData5";
    public static final String COLUMN_SensorType6="SensorType6";
    public static final String COLUMN_SensorData6="SensorData6";
    public static final String COLUMN_SensorType7="SensorType7";
    public static final String COLUMN_SensorData7="SensorData7";
    public static final String COLUMN_SensorType8="SensorType8";
    public static final String COLUMN_SensorData8="SensorData8";
    public static final String COLUMN_SensorType9="SensorType9";
    public static final String COLUMN_SensorData9="SensorData9";
    public static final String COLUMN_SensorTypeArray="SensorTypeArray";
    public static final String COLUMN_Username = "Username";
    public static final String COLUMN_ClientID = "ClientID";
    public static final String COLUMN_Password = "Password";
    public static final String COLUMN_SaveFlag = "SaveFlag";
    public static final String COLUMN_LocalInfo = "LocalInfo";
    public static final String COLUMN_Area = "Area";
    public static  final String[] COLUMN = new String[]{COLUMN_Index, COLUMN_Gateway, COLUMN_NodeName, COLUMN_Time,
            COLUMN_BatteryLevel, COLUMN_SensorNum, COLUMN_SensorType0, COLUMN_SensorData0, COLUMN_SensorType1,
            COLUMN_SensorData1, COLUMN_SensorType2, COLUMN_SensorData2, COLUMN_SensorType3, COLUMN_SensorData3,
            COLUMN_SensorType4, COLUMN_SensorData4, COLUMN_SensorType5, COLUMN_SensorData5, COLUMN_SensorType6,
            COLUMN_SensorData6, COLUMN_SensorType7, COLUMN_SensorData7, COLUMN_SensorType8, COLUMN_SensorData8,
            COLUMN_SensorType9, COLUMN_SensorData9};
    /**
     * 创建数据库的命令
     * */
    public static final String CREATE_SensorData_Table ="create table "+
            Data.SensorData_Table+"("+
            Data.COLUMN_Index+" integer primary key autoincrement,"+
            Data.COLUMN_Gateway +" TEXT(10),"+
            Data.COLUMN_NodeName+" TEXT(10),"+
            Data.COLUMN_Time+" TEXT(10),"+
            Data.COLUMN_BatteryLevel+" integer,"+
            Data.COLUMN_SensorNum+" integer,"+
            Data.COLUMN_SensorType0+" TEXT(10),"+
            Data.COLUMN_SensorData0+" real,"+
            Data.COLUMN_SensorType1+" TEXT(10),"+
            Data.COLUMN_SensorData1+" real,"+
            Data.COLUMN_SensorType2+" TEXT(10),"+
            Data.COLUMN_SensorData2+" real,"+
            Data.COLUMN_SensorType3+" TEXT(10),"+
            Data.COLUMN_SensorData3+" real,"+
            Data.COLUMN_SensorType4+" TEXT(10),"+
            Data.COLUMN_SensorData4+" real,"+
            Data.COLUMN_SensorType5+" TEXT(10),"+
            Data.COLUMN_SensorData5+" real,"+
            Data.COLUMN_SensorType6+" TEXT(10),"+
            Data.COLUMN_SensorData6+" real,"+
            Data.COLUMN_SensorType7+" TEXT(10),"+
            Data.COLUMN_SensorData7+" real,"+
            Data.COLUMN_SensorType8+" TEXT(10),"+
            Data.COLUMN_SensorData8+" real,"+
            Data.COLUMN_SensorType9+" TEXT(10),"+
            Data.COLUMN_SensorData9+" real"+
            ")";
    public static final String CREATE_IDArray_Table = "create table "+
            Data.NodeArray_Table+"("+
            Data.COLUMN_Index+" integer primary key autoincrement,"+
            Data.COLUMN_Gateway +" TEXT(10),"+
            Data.COLUMN_NodeName+" TEXT(10),"+
            Data.COLUMN_NodeState+" integer,"+
            Data.COLUMN_SensorNum+" integer,"+
            Data.COLUMN_SensorTypeArray+" TEXT"+
            ")";
    public static final String CREATE_USERINFO_Table = "create table "+
            Data.UserInfo_Table+"("+
            Data.COLUMN_Index+" integer primary key autoincrement,"+
            Data.COLUMN_Username +" TEXT,"+
            Data.COLUMN_ClientID +" TEXT,"+
            Data.COLUMN_Password+" TEXT"+
            ")";

    public static final String CREATE_NODELOCAL_Table = "create table "+
            Data.NodeLocal_Table+"("+
            Data.COLUMN_Index+" integer primary key autoincrement,"+
            Data.COLUMN_Gateway +" TEXT,"+
            Data.COLUMN_NodeName +" TEXT,"+
            Data.COLUMN_Area +" TEXT,"+
            Data.COLUMN_LocalInfo+" TEXT"+
            ")";
    /**
     * MQTT主题定义
     * */
    public static final String MQTTReceiveMessage = "MQTTReceiveMessage";
    public static final String MQTTPublishMessage= "MQTTPublishMessage";
    public static final String TopicLoongSonSync = "GatewaySync";
    public static final String TopicLoongSonSyncRequest = "GatewaySyncRequest";
    public static final String TopicNodeSync = "NodeSync";
    public static final String TopicNodeSyncRequest = "/NodeSyncRequest";
    public static final String TopicLoongSonWill = "GatewayWill";
    public static final String TopicControlNodeCmd = "/ControlNodeCmd";
    public static final String TopicSyncNodeStatus = "SyncNodeStatus";
    public static final String TopicData = "Data";
    public static final String TopicSensnorStatusSyncRequest = "/SensnorStatusSyncRequest";
    public static final String TopicSensorStatusSync = "SensorStatusSync";
    public static final String TopicControlCar = "/ControlCarCmd";
    public static final String TopicNodeLocalSyncRequest = "/NodeLocalSyncRequest";
    public static final String TopicNodeLocalSync = "NodeLocalSync";
    /**
     * OneNet平台信息
     * */
    public static final String MqttHost = "tcp://183.230.40.39:6002";
    public static final String Mqtt_Username ="611914";
    public static final int MqttConnect_Maximum = 3;
    /**
     * 数据表显示的最大历史数据量
     * */
    public static final int NumberHistoricalData = 50;
    /**
     * 时间字段的格式
     */
    public static final String DATE_FORMAT_Y="yyyy-MM-dd HH:mm:ss";
    public static final String DATE_FORMAT_D="HH:mm:ss";
    /**
     * 时间字段的降序，采用date函数比较
     */
    public static final String ORDER_BY="date("+COLUMN_Time+") desc";
    public static final Integer Picture_X = 1700;
    public static final Integer Picture_Y = 2227;

    public static final String DISPLAY_MODE = "DisplayMode";
    public static final int DISPLAY_Humiture = 2131296854;
    public static final int DISPLAY_AQI = 2131296849;
    public static final int DISPLAY_CH4 = 2131296850;
    public static final int RADIOBUTTONID = 2000;
    public static final String SENSORINDEX = "SensorIndex";
    public static final String SENSORTYPE = "SensorType";
    public static final String CarControlCMD = "CarControlCMD";
    public static final String CONTROLAdvance = "ControlAdvance";
    public static final String CONTROLLeftTurn = "ControlLeftTurn";
    public static final String CONTROLRightTurn = "ControlRightTurn";
    public static final String CONTROLBack = "ControlBack";
    public static final String LeftFront = "LeftFront";
    public static final String RightFront = "RightFront";
    public static final String LeftRear = "LeftRear";
    public static final String RightRear = "RightRear";
    public static final String FixedGateway = "FixedGateway";
    public static final String MobileGateway = "MobileGateway";
    public static final String GatewayType = "GatewayType";
    /**
     * #define TempUnit "Temp/°C"
     * #define HumpUnit "Hump/%RH"
     * #define LightUnit "Light/Lux"
     * #define CO2Unit "CO2/PPM"
     * #define TVOCUnit "TVOC/PPB"
     * #define CH4Unit "CH4/PPM"
     * #define PM2_5Unit "PM2.5"
     * */
    public static final String TempUnit = "Temp/°C";
    public static final String HumpUnit = "Hump/%RH";
    public static final String LightUnit = "Light/Lux";
    public static final String CO2Unit = "CO2/PPM";
    public static final String TVOCUnit = "TVOC/PPB";
    public static final String CH4Unit = "CH4/PPM";
    public static final String PM2_5Unit = "PM2.5";
    public static final String NodeStatus = "NodeStatus";
}
